<%@ page import="bean.BookBean,java.util.ArrayList,dao.BookDao,java.sql.SQLException" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图书查询</title>
    <link rel="stylesheet" href="css/bm.css">
</head>

<body>
<% //到数据库中查询所有学生
    ArrayList<BookBean> all = null;
    all = (ArrayList<BookBean>) request.getAttribute("data");
%>
<header>
    <span class="sp">欢迎使用图书管理系统</span>
    <span class="adm">欢迎你，用户</span>
</header>
<div class="center">
    <div class="head">
        <h1>图书查询</h1>
        <form action='selectServlet' method='post' style="margin-left: -130px;">
            <span>请输入图书名称：</span> <input type='text' name="name">
            <input type='submit' value='查找' />
            <a href="index2.html">返回主界面</a>
        </form>
    </div>

    <table>
        <tr>
            <th>图书id</th>
            <th>图书名</th>
            <th>图书编号</th>
            <th>作者</th>
            <th>图书数量</th>
            <th>出版社</th>
            <th>图书类别</th>
            <th>操作</th>
        </tr>

        <%
            //定义一个颜色数组
            String[] mycol = {"silver", "pink"};
            for (int i = 0; i < all.size(); i++) {
                BookBean b = (BookBean) all.get(i);
        %>
        <tr bgcolor=<%=mycol[i % 2]%>>
            <td><%=b.getBid() %>
            </td>
            <td><%=b.getName() %>
            </td>
            <td><%=b.getCard() %>
            </td>
            <td><%=b.getAutho() %>
            </td>
            <td><%=b.getNum() %>
            </td>
            <td><%=b.getPress() %>
            </td>
            <td><%=b.getType() %>
            </td>
            <td><a href=borrowServlet?tip=1&bid=<%=b.getBid()%>>借书</a> </td>
        </tr>

        <%} %>
    </table>
</div>
<div class="buttom">
    <span>欢迎使用图书管理系统</span>
</div>
</body>

</html>
